From: Philip Withnall Date: Thu, 18 May 2017 07:11:32 +0000 (+0100) Subject: lib/remote: Add a getter for OstreeRemote.name X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~36^2~84 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22%22?a=commitdiff_plain;h=d2eaded90de24fa17649d4812e92005f75694d22;p=ostree.git lib/remote: Add a getter for OstreeRemote.name Now that we’ve got a public, sealed OstreeRemote structure, we can start carefully exposing members of it as API. Signed-off-by: Philip Withnall Closes: #875 Approved by: cgwalters --- diff --git a/apidoc/ostree-experimental-sections.txt b/apidoc/ostree-experimental-sections.txt index 790feb33..998a4f9c 100644 --- a/apidoc/ostree-experimental-sections.txt +++ b/apidoc/ostree-experimental-sections.txt @@ -3,4 +3,5 @@ OstreeRemote ostree_remote_ref ostree_remote_unref +ostree_remote_get_name diff --git a/src/libostree/libostree-experimental.sym b/src/libostree/libostree-experimental.sym index e2ab4ea8..1d4feeda 100644 --- a/src/libostree/libostree-experimental.sym +++ b/src/libostree/libostree-experimental.sym @@ -29,3 +29,8 @@ global: ostree_remote_ref; ostree_remote_unref; } LIBOSTREE_2017.6; + +LIBOSTREE_2016.7_EXPERIMENTAL { +global: + ostree_remote_get_name; +} LIBOSTREE_2017.6_EXPERIMENTAL; diff --git a/src/libostree/ostree-remote.c b/src/libostree/ostree-remote.c index 86fae8d8..f34fafa4 100644 --- a/src/libostree/ostree-remote.c +++ b/src/libostree/ostree-remote.c @@ -148,3 +148,23 @@ G_DEFINE_BOXED_TYPE(OstreeRemote, ostree_remote, ostree_remote_ref, ostree_remote_unref); #endif + +/** + * ostree_remote_get_name: + * @remote: an #OstreeRemote + * + * Get the human-readable name of the remote. This is what the user configured, + * if the remote was explicitly configured; and will otherwise be a stable, + * arbitrary, string. + * + * Returns: remote’s name + * Since: 2017.7 + */ +const gchar * +ostree_remote_get_name (OstreeRemote *remote) +{ + g_return_val_if_fail (remote != NULL, NULL); + g_return_val_if_fail (remote->ref_count > 0, NULL); + + return remote->name; +} diff --git a/src/libostree/ostree-remote.h b/src/libostree/ostree-remote.h index 8e96213c..5505bc1d 100644 --- a/src/libostree/ostree-remote.h +++ b/src/libostree/ostree-remote.h @@ -60,4 +60,7 @@ void ostree_remote_unref (OstreeRemote *remote); #endif /* GI_SCANNER */ #endif +_OSTREE_PUBLIC +const gchar *ostree_remote_get_name (OstreeRemote *remote); + G_END_DECLS